<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>添加记录</title>
    <link rel="stylesheet" href="../systemPage/css/public.css">
    <script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<script type="text/javascript">
    $(function(){
        //ajax函数，添加数据
        function addEpidemic(){
            //var str=JSON.stringify({"record_date":$("#record_date").val(),"id_batch":$("#id_batch").val(),"num_processed":$("#num_processed").val(),"processing_mode":$("#processing_mode").val(),"id_recorder":$("#id_recorder").val(),"id_charge":$("#id_charge").val(),"remark":$("#remark").val()});
            $.ajax({
                type:"post",
                url:"/waterfowl/epidemic/save",
                data:{
                    "recordDate":$("#record_date").val(),
                    "idPatch":$("#id_patch").val(),
                    "name":$("#name").val(),
                    "sign":$("#sign").val(),
                    "diseaes":$("#diseaes").val(),
                    "numInfected":$("#num_infected").val(),
                    "processingMode":$("#processing_mode").val(),
                    "medicationMode":$("#medication_mode").val(),
                    "dose":$("#dose").val(),
                    "doseUnit":$("#dose_unit").val(),
                    "idRecorder":$("#id_recorder").val(),
                    "idCharge":$("#id_charge").val(),
                    "remark":$("#remark").val(),
                },
                dataType:"json",//回调数据的格式
                success:function(data){
                    if(data.status==="1"){
                        alert("添加成功");
                    }else{
                        alert("添加失败");
                    }
                },
            });
        }

        //点击添加数据的按钮
        $(".btn").click(function(){
            //调用ajax添加函数
            addEpidemic();
        });

        //默认记录日期网为当天
        var record_date =document.getElementById("record_date");//设置类型为date的input元素的默认值
        record_date.valueAsDate = new Date()
    });
</script>
<body>
  <table>
    <tr>
        <th>记录日期</th>
        <th>批次编号</th>
        <th>药品名称</th>
        <th>免疫、疫病标志</th>
        <th>疾病</th>
        <th>染病个体数</th>
        <th>处理方式</th>
        <th>给药方式</th>
        <th>剂量</th>
        <th>剂量单位</th>
        <th>记录者编号</th>
        <th>负责人编号</th>
        <th>备注</th>
    </tr>
      <tr>
          <td><input type="date" id="record_date"></td>
          <td><input type="text" id="id_patch" placeholder="批次编号" ></td>
          <td><input type="text" id="name" placeholder="批次编号" ></td>
          <td><input type="text" id="sign" placeholder="免疫、疫病标志"></td>
          <td><input type="text" id="diseaes" placeholder="疾病"></td>
          <td><input type="text" id="num_infected" placeholder="染病个体数"></td>
          <td><input type="text" id="processing_mode" placeholder="处理方式"></td>
          <td><input type="text" id="medication_mode" placeholder="给药方式"></td>
          <td><input type="text" id="dose" placeholder="剂量"></td>
          <td><input type="text" id="dose_unit" placeholder="剂量单位"></td>
          <td><input type="text" id="id_recorder" placeholder="记录者"></td>
          <td><input type="text" id="id_charge" placeholder="负责人"></td>
          <td><input type="text" id="remark" placeholder="备注"></td>
    </tr>
  </table>

</body>
</html>